package com.lxy.demo.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lxy.demo.dao.BookInfoMapper;
import com.lxy.demo.entity.BookInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class BookInfoServiceImpl implements BookInfoService {
    @Autowired
    private BookInfoMapper bookInfoMapper;

    @Override
    public PageInfo findBook(Integer pageNum, Integer bookType, String bookName, String isBorrow) {
        PageHelper.startPage(pageNum, 5);
        List<BookInfo> list = bookInfoMapper.selectBook(bookType, bookName, isBorrow);
        PageInfo pageInfo = new PageInfo(list);
        return pageInfo;
    }
}
